/*
*  An example application that shows how you can input a matrix easily
*  using the tools matrixfunctions provides.
*  Copyright (c) 2008, <Kristof Bal>, the New BSD License
*/
#include <stdio.h>
#include "matrixfunctions.h"

main(){
  matrix m;
  int rowcounter=0;
  int columncounter=0;

  printf("Enter the number of columns and rows the matrix should have:");
  scanf("%d %d", &m.i, &m.j);
  //Start row by row, beginning with "0" (or 1, but an array starts with 0
  while (rowcounter<i){
    //The real work is done in the row, column by column
    while (columncounter<j){
      scanf("%lf", &m.values[rowcounter][columncounter]);
      columncounter++;  //switch to next column
    }
    columncounter=0;  //prepare for next row...
    rowcounter++;     //...and switch to it
  }
  printf("\n");
  //Example that checks if everything has gone OK
  printf("%f", m.values[0][0]);
}